<template>
	<div id="child">
		<div>
			<p>{{name}}</p>
			<p>{{nameaa}}</p>
			<button @click="sendParent">子传父</button>
		</div>
	</div>
</template>

<script>
	export default {
		name: 'child',
		props: ['name'],
		data() {
			return {
				nameaa: this.name,
			}
		},
		methods: {
			sendParent: function(e) {
				this.$emit("listenToChildEvent","子传父");
			},
		},
		//刷新  和 keep-alive 一起用才有作用
		activated: function() {
			console.log("从父级接受过来的值："+this.nameaa);
		}
	}
</script>
